package com.itheima.stock.config;

import com.itheima.stock.properties.IdWorkProperties;
import com.itheima.stock.util.IdWorkers;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 雪花生成器配置类
 */
@Configuration
public class IdWorkersConfig {

    @Bean
    public IdWorkers idWorkers(IdWorkProperties idWorkProperties) {
        return new IdWorkers(idWorkProperties.getWorkerId(), idWorkProperties.getDatacenterId());
    }

}
